﻿using System.Net.Sockets;
using System.Text;

namespace HUNTERS.HELPERS
{
    public class UClient
    {
        private UdpClient udpClient;
        private byte[] sendBytes;
        private string hostName;
        private int port;

        public UClient(string _hostName, int _port)
        {
            udpClient = new UdpClient();
            hostName = _hostName;
            port = _port;
        }

        public void SendMessage(string message)
        {
            if (udpClient != null)
            {
                udpClient.Connect(hostName, port);
                sendBytes = Encoding.ASCII.GetBytes(message);
                udpClient.Send(sendBytes, sendBytes.Length);
            }
            
        }
    }
}
